package com.design.mode.aop;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @ClassName Buy2Aspect
 * @Description   通过申明切点表达式的方式  优化切入点调用   @PointCut
 * @Author xiongchao
 * @Date 2020/10/10 14:20
 **/
@Aspect
@Component
public class Buy2Aspect {

    @Pointcut("execution(* com.design.mode.aop.IBuy.buy(..))")
    public void pointCut(){

    }

    @Before("pointCut()")
    public void before(){
        System.out.println("before");
    }

    @After("pointCut()")
    public void after(){
        System.out.println("after");
    }

    @AfterReturning("pointCut()")
    public void afterRetuning(){
        System.out.println("after returning");
    }
}
